<template>
  <router-view></router-view>
</template>

<script lang="ts" setup>
  import useStore from "./store/user.ts";
  const userStore = useStore()
  if(sessionStorage.getItem('user') != 'undefined'){
    let user = JSON.parse(sessionStorage.getItem('user'))
    userStore.setUser(user)
  }
//   const userData = sessionStorage.getItem('user');

// if (userData) {
//   try {
//     // 尝试解析 JSON 数据
//     const user = JSON.parse(userData);
//     console.log(user);
    
//     userStore.setUser(user); // 将解析后的用户信息传给 store
//   } catch (error) {
//     console.error('Failed to parse user data from sessionStorage:', error);
//   }
// } else {
//   console.log('No user data found in sessionStorage.');
// }
</script>




